package org.kukker.dialog;

import org.kukker.R;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.Spinner;

public class PreferenceDialog extends Dialog{
	private Button okButton;
	final String[] mStrings = {
	        "1 hour","2 hours","1 day", "2 days", "3 days"
	    };
	private Spinner remindSpinner;
	private CheckBox cb_autodelete;
	private CheckBox cb_autoremind;
	private ArrayAdapter<String> adapter;
	
	private Context mContext;
	public PreferenceDialog(Context context) {
		super(context);
		this.mContext = context;
		
		this.setContentView(R.layout.dialog_preferences);
		this.setTitle("Preferences");
		
		this.okButton = (Button) this.findViewById(R.id.dialog_preferences_button_ok);
		this.okButton.setOnClickListener(new View.OnClickListener(){
			public void onClick(View arg0) {
				dismiss();				
			}
		});
		
		this.remindSpinner = (Spinner) this.findViewById(R.id.dialog_preferences_spinner_remindervalue);
		this.adapter =  new ArrayAdapter<String>(this.mContext,  android.R.layout.simple_spinner_item ,this.mStrings);
		this.remindSpinner.setAdapter(adapter);
	
		this.cb_autodelete = (CheckBox) this.findViewById(R.id.dialog_preferences_checkbox_autodeletepast);
		this.cb_autoremind = (CheckBox) this.findViewById(R.id.dialog_preferences_checkbox_autoreminder);
		this.cb_autoremind.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
			public void onCheckedChanged(CompoundButton btn, boolean checked){			
				remindSpinner.setEnabled(checked);		
			}
		});
	}
	
	
}